var ajax = {
    post: function (url, data, callback) {
        var xhr = new XMLHttpRequest();
        xhr.open("post", url);
        xhr.setRequestHeader("content-type", "application/json");
        xhr.send(JSON.stringify(data));
        xhr.onreadystatechange = function () {
            if (xhr.readyState == 4 && xhr.status == 200) {
                callback(JSON.parse(xhr.responseText));
            }
        }
    },
    wer: function (url, json, callback) {
        var qw = new XMLHttpRequest();
        var str = "";
        for (var i in json) {
            str += i + "=";
            str += json[i];
            str += "&";
        }
        qw.open("get", url + "?" + str);
        qw.send();
        qw.onreadystatechange = function () {
            if (qw.readyState == 4 && qw.status == 200) {
                callback(JSON.parse(qw.responseText));
            }
        }
    },
    get: function (url, json, callback) {
        var xhr = new XMLHttpRequest();
        var str = "";
        for (var key in json) {
            str += key + "=";
            str += json[key];
            str += "&";
        }
        xhr.open("get", url + "?" + str);
        xhr.setRequestHeader("content-type", "application/x-www-form-urlencoded");
        xhr.send();
        xhr.onreadystatechange = function () {
            if (xhr.readyState == 4 && xhr.status == 200) {
                callback(JSON.parse(xhr.responseText));
            }
        }
    }
}